package org.meb.speedway.bean;

import java.util.List;

import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import javax.inject.Inject;

import org.meb.speedway.Query;
import org.meb.speedway.dao.DaoResolver;

@Stateless
public class SearchServiceBean implements SearchService {

	@Inject
	private DaoResolver daoResolver;

	public SearchServiceBean() {
	}

	@Override
	@TransactionAttribute(TransactionAttributeType.REQUIRED)
	public <T> List<T> find(Query<T> query) {
		return daoResolver.resolve(query.getEntityClass()).find(query);
	}
}
